﻿
@{
    ViewBag.Title = "List";
    Layout = "~/Views/Shared/_ManageLayoutPage.cshtml";
}

<ul id="demo"></ul>
<button id="show">show</button>
<script type="text/html" id="form-temp">
    <form class="layui-form">
        <input type="text" class="layui-input" name="userName" />

        <button lay-submit lay-filter="test" class="layui-btn">提交</button>
    </form>

</script>


@section scripts{
<script src="~/Plugins/layui/lay/dest/layui.all.js"></script>

    <script>
        var form = layui.form(), layer = layui.layer, $ = layui.jquery;
        $('#show').on('click', function () {
            layer.open({
                type: 1,
                title: '标题',
                area: ['350px', '220px'],
                content: $('#form-temp').html(),
                success: function (layero, index) {
                    form.on('submit(test)', function (data) {
                        console.log(data) 
                        return false; 
                    });
                }
            });
        });



        layui.use(['tree', 'layer'], function () {
            var $ = layui.jquery
            ,layer = layui.layer;


            layui.tree({
                elem: '#demo', //传入元素选择器
                nodes: [ //节点
                    {
                        name: '常用文件夹',
                        id: 1,
                        alias: 'changyong',
                        children: [{
                            name: '所有未读',
                            id: 11,
                            href: 'http://www.layui.com/',
                            alias: 'weidu'
                        }, {
                            name: '置顶邮件',
                            id: 12
                        }, {
                            name: '标签邮件',
                            id: 13
                        }]
                    }, {
                        name: '我的邮箱',
                        id: 2,
                        spread: true,
                        children: [{
                            name: 'QQ邮箱',
                            id: 21,
                            spread: true,
                            children: [{
                                name: '收件箱',
                                id: 211,
                                children: [{
                                    name: '所有未读',
                                    id: 2111
                                }, {
                                    name: '置顶邮件',
                                    id: 2112
                                }, {
                                    name: '标签邮件',
                                    id: 2113
                                }]
                            }, {
                                name: '已发出的邮件',
                                id: 212
                            }, {
                                name: '垃圾邮件',
                                id: 213
                            }]
                        }, {
                            name: '阿里云邮',
                            id: 22,
                            children: [{
                                name: '收件箱',
                                id: 221
                            }, {
                                name: '已发出的邮件',
                                id: 222
                            }, {
                                name: '垃圾邮件',
                                id: 223
                            }]
                        }]
                    }
                ],
                click: function (node) {
                    layer.msg(node.name);
                }
            });

        });
    </script>
}